package com._119yn.host.gst200.cansocket.codec;

import com._119yn.host.gst200.cansocket.message.Ping;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;

public class PingEncoder extends ChannelOutboundHandlerAdapter {
    @Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        if (msg instanceof Ping) {
            ctx.write("ping");
        } else {
            ctx.write(msg);
        }
    }
}
